// const data = [
//     {value: 100, name: '浙江省'},
//     {value: 45, name: '江苏省'},
//     {value: 38, name: '上海市'},
//     {value: 22, name: '北京市'}
// ]
const config = {
    title: {
        text: '省外客流来源统计',
        top: 10,
        left:10,
        textStyle: {
            color: '#ccc'
        },
    },
    tooltip: {
        trigger: 'item'
    },
    legend: {
        selectedMode:false,
        itemWidth: 10,  // 设置宽度
        itemHeight: 10, // 设置高度
        left:'center',
        top: '82%',
        textStyle: {
            fontSize:'12px',
            color: '#fff',
            rich:{
                tip:{
                    color:'red',
                    padding:[0,0,0,4]
                }
            }
        },
        formatter: function (params) {
            for (var i = 0; i < config.series[0].data.length; i++) {
                if (config.series[0].data[i].name && config.series[0].data[i].name == params) {
                    return 'params' + ":" + '{tip|' + config.series[0].data[i].value + '}';
                }
            }
        },
    },
    series: [{
        name: '访问来源',
        type: 'pie',
        radius: ['65%', '75%'],
        center: ['50%', '50%'],
        avoidLabelOverlap: false,
        label: {
            color: '#fff',
            show: false,
            position: 'center',
        },
        emphasis: {
            label: {
                show: false,
                fontSize: '20',
                fontWeight: 'bold',
            },
        },
        data: [{
                value: 100,
                name: '浙江省'
            },
            {
                value: 45,
                name: '江苏省'
            },
            {
                value: 38,
                name: '上海市'
            },
            {
                value: 22,
                name: '北京市'
            }
        ].sort(function (a, b) {
            return a.value - b.value;
        }),
        labelLine: {
            lineStyle: {
                color: 'rgba(255, 255, 255, 0.3)'
            },
            smooth: 0.5,
            length: 10,
            length2: 20,
            show: false,
        },
        animationType: 'scale',
        animationEasing: 'elasticOut',
        animationDelay: function (idx) {
            return Math.random() * 2000;
        }
    }]
};

const config2 = {
    tooltip: {
        trigger: 'item'
    },
    legend: {
        selectedMode:false,
        type: 'scroll',
        orient: 'vertical',
        icon: "circle",
        itemWidth: 10,  // 设置宽度
        itemHeight: 10, // 设置高度
        left: '20%',
        top: 'center',
        extraCssText:'z-index:999',
        bottom: 20,
        textStyle: {
            fontSize:'16px',
            color: '#fff',
            rich:{
                tip:{
                    fontSize:'14px',
                    color: "#979797",
                    padding:[0,0,0,8]
                }
            }
        },
        formatter: function (params) {
            for (var i = 0; i < config.series[0].data.length; i++) {
                if (config.series[0].data[i].name && config.series[0].data[i].name == params) {
                    return 'params' + ":" + '{tip|' + config.series[0].data[i].value + '}';
                }
            }
        },
    },
    series: [{
        name: '访问来源',
        type: 'pie',
        width:0,
        avoidLabelOverlap: false,
        label: {
            color: '#fff',
            show: false,
            position: 'center',
        },
        emphasis: {
            label: {
                show: false,
                fontSize: '20',
                fontWeight: 'bold',
            },
        },
        data: [{
                value: 100,
                name: '浙江省'
            },
            {
                value: 45,
                name: '江苏省'
            },
            {
                value: 38,
                name: '上海市'
            },
            {
                value: 22,
                name: '北京市'
            }
        ].sort(function (a, b) {
            return a.value - b.value;
        }),
        labelLine: {
            lineStyle: {
                color: 'rgba(255, 255, 255, 0.3)'
            },
            smooth: 0.5,
            length: 10,
            length2: 20,
            show: false,
        },
        animationType: 'scale',
        animationEasing: 'elasticOut',
        animationDelay: function (idx) {
            return Math.random() * 2000;
        }
    }]
};
export {
    config,config2
}